home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / utility / blrmu13.zip / CCC.ASM < prev    next >
Assembly Source File  |  1991-04-28  |  6KB  |  198 lines

  1. page ,132
  2. title ccc ( color change com ) as of 04/28/91 - 02:45 pm
  3. ;*-------------------------------------------------
  4. ;
  5. ;        Color Change Com
  6. ;
  7. ;        does color changes to:
  8. ;        foreground,
  9. ;        background,
  10. ;        edge( if not ega,vga )
  11. ;
  12. ;        syntax : ccc f=nn,b=nn,e=nn
  13. ;
  14. ;        where nn = 00-15 decimal
  15. ;
  16. ;        if no parms,
  17. ;        default to yellow on brown
  18. ;
  19. ;*-------------------------------------------------
  20. code     segment para public 'code'
  21. ;
  22.          assume  cs:code,ds:code,es:code
  23. ;
  24.          org   128
  25. ;
  26. pl       db    0            ; parm len ( includes space )
  27.          db    0            ; space
  28. ff       db    0            ; f
  29.          db    0            ; =
  30. f        db    0,0          ; nn
  31.          db    0            ; ,
  32. bb       db    0            ; b
  33.          db    0            ; =
  34. b        db    0,0          ; nn
  35.          db    0            ; ,
  36. ee       db    0            ; e
  37.          db    0            ; =
  38. e        db    0,0          ; nn
  39. ;
  40. sf       db    0            ; save fore
  41. sb       db    0            ; save back
  42. se       db    0            ; save edge
  43. ;
  44. mbtf     dw    1
  45. ;
  46.          org   256
  47. ;
  48. ccc:
  49. ;
  50.          cmp   pl,0         ; parm len = 0 ?
  51.          je    default      ; if so, default
  52. ;
  53. cff:     mov   al,ff        ; get foreground key
  54. ;
  55.          cmp   al,'f'       ; foreground key there ?
  56.          je    cbb          ; if so, check background
  57.          cmp   al,'F'       ; foreground key there ?
  58.          je    cbb          ; if so, check background
  59.          jmp   default      ; take default
  60. ;
  61. cbb:     mov   al,bb        ; get background key
  62. ;
  63.          cmp   al,'b'       ; background key there ?
  64.          je    cee          ; if so, check edge
  65.          cmp   al,'B'       ; background key there ?
  66.          je    cee          ; if so, check edge
  67.          jmp   default      ; take default
  68. ;
  69. cee:     mov   al,ee        ; get edge key
  70. ;
  71.          cmp   al,'e'       ; edge key there ?
  72.          je    pp           ; if so, process parameters
  73.          cmp   al,'E'       ; edge key there ?
  74.          je    pp           ; if so, process parameters
  75. ;
  76. default:
  77. ;
  78.          mov   sf,14        ; default fore = yellow
  79.          mov   sb,6         ; default back = brown
  80.          mov   se,6         ; default edge = brown
  81.          jmp   ssbc         ; and skip process parameters
  82. ;
  83. pp:
  84.          lea   si,f         ; ptr to in
  85.          lea   di,sf        ; ptr to out
  86.          mov   sf,0         ; clear out
  87.          mov   bx,2         ; set in len
  88.          call  catb         ; convert
  89. ;
  90.          lea   si,b         ; ptr to in
  91.          lea   di,sb        ; ptr to out
  92.          mov   sb,0         ; clear out
  93.          mov   bx,2         ; set in len
  94.          call  catb         ; convert
  95. ;
  96.          lea   si,e         ; ptr to in
  97.          lea   di,se        ; ptr to out
  98.          mov   se,0         ; clear out
  99.          mov   bx,2         ; set in len
  100.          call  catb         ; convert
  101. ;
  102. ;*-------------------------------
  103. ;* set sixteen background colors
  104. ;*-------------------------------
  105. ssbc:
  106.          mov   al,9                    ; set blink bit to intensity
  107.          mov   dx,3d8h                 ; set color register
  108.          out   dx,al                   ; send al to dx
  109. ;*------------------------
  110. ;*  set edge color
  111. ;*------------------------
  112. sec:
  113.          mov   ah,11                   ; set color palette fct
  114.          mov   bh,0                    ; text mode
  115.          mov   bl,se                   ; get edge color
  116.          int   16
  117. ;*------------------------
  118. ;*  set cursor position
  119. ;*------------------------
  120. scp:
  121.          mov   ah,2                    ; set cursor position fct
  122.          mov   bh,0                    ; page 0
  123.          mov   dh,0                    ; row 0
  124.          mov   dl,0                    ; col 0
  125.          int   16
  126. ;*--------------------------------
  127. ;*  write character and attribute
  128. ;*--------------------------------
  129. wcaa:
  130.          mov   bl,sf                   ; get foreground
  131.          mov   al,sb                   ; get background
  132.          mov   cl,4                    ; set for shift
  133.          shl   al,cl                   ; shift t0 left nibble
  134.          or    bl,al                   ; OR with background
  135. ;
  136.          mov   ah,9                    ; write char and attr
  137.          mov   al,32                   ; space is char
  138.          mov   bh,0                    ; page is 0
  139.          mov   cx,2000                 ; 25 * 80 = full screen
  140.          int   16
  141. ;
  142. exit:    mov   al,0                    ; ret code = 0
  143.          mov   ah,76                   ; term with ret code
  144.          int   33
  145. ;
  146. ;*------------------------------
  147. ;*   convert ascii to binary
  148. ;*------------------------------
  149. ;*------------------------------
  150. ;* converts an ascii decimal
  151. ;* input pointed to by si,
  152. ;* to a dw binary output field
  153. ;* pointed to by di,
  154. ;* with the input width in bx,
  155. ;* and using a dw multiply
  156. ;* temporary field named mbtf
  157. ;*------------------------------
  158. catb     proc  near
  159.          push  ax
  160.          push  cx
  161.          mov   cx,10
  162.          mov   mbtf,1
  163.          sub   si,1
  164. ;
  165. catbl:
  166.          mov   al,[si+bx]
  167.          and   ax,15
  168.          mul   mbtf
  169.          add   [di],ax
  170.          mov   ax,mbtf
  171.          mul   cx
  172.          mov   mbtf,ax
  173.          dec   bx
  174.          jnz   catbl
  175.          pop   cx
  176.          pop   ax
  177.          ret
  178. catb     endp
  179. ;
  180. code     ends
  181. ;
  182.          end   ccc
  183. ;
  184. ;---------------------------------------
  185. ;  Color Chart
  186. ;---------------------------------------
  187. ;
  188. ;  Black    = 00   Light Black    = 08
  189. ;  Blue     = 01   Light Blue     = 09
  190. ;  Green    = 02   Light Green    = 10
  191. ;  Cyan     = 03   Light Cyan     = 11
  192. ;  Red      = 04   Light Red      = 12
  193. ;  Magenta  = 05   Light Magenta  = 13
  194. ;  Brown    = 06   Light Brown    = 14     ( Yellow )
  195. ;  White    = 07   Light White    = 15
  196. ;
  197. ;---------------------------------------
  198.